﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace WiX_Standardizer.Common.Elements
{
	public static class Upgrade
	{
		public static XElement Create()
		{
			XElement majorUpgrade = new XElement(SettingsParser.General.GetWixNamespace() + "MajorUpgrade");

			string downgradeErrorMessage = SettingsParser.Upgrade.GetDowngradeErrorMessage();
			string schedule = SettingsParser.Upgrade.GetSchedule();

			if (!string.IsNullOrWhiteSpace(schedule))
				majorUpgrade.Add(new XAttribute("Schedule", schedule));
			majorUpgrade.Add(new XAttribute("DowngradeErrorMessage", downgradeErrorMessage));

			return majorUpgrade;
		}

		public static XElement Correct(XElement startingPoint)
		{
			XElement majorUpgrade = startingPoint;

			return majorUpgrade;
		}
	}
}
